package co.com.inventarios.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class GetLocalIP {

	private InetAddress addr;
	private byte[] ipAddr;

	public InetAddress getAddr() {
		return addr;
	}

	public void setAddr(InetAddress addr) {
		this.addr = addr;
	}

	public byte[] getIpAddr() {
		return ipAddr;
	}

	public void setIpAddr(byte[] ipAddr) {
		this.ipAddr = ipAddr;
	}

	public String obtenerIP() {
		try {
			setAddr(InetAddress.getLocalHost());
			setIpAddr(getAddr().getAddress());			
			return getAddr().toString();
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
}
